package com.test.vote.service;

import com.test.vote.mapper.UserDao;
import com.test.vote.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class userService {
    @Resource
    UserDao userDao;

    //查询所有用户
    public List<User> selectUser() {
        return userDao.selectUser();
    }

    //管理员添加用户
    public int addUser(User user) {
        return userDao.insert(user);
    }

    //管理员禁用用户
    public int banUser(User user) {
        return userDao.updateByPrimaryKeySelective(user);
    }

    //管理员删除用户
    public int deleteUser(User user) {
        return userDao.deleteByPrimaryKey(user);
    }
}
